home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 10464 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  891 b 

  1. Path: lantana.singnet.com.sg!usenet
  2. From: s8700055@singnet.com.sg (XY Xie)
  3. Newsgroups: comp.lang.c
  4. Subject: Input filename for fopen()?
  5. Date: Mon, 18 Mar 1996 04:21:09 GMT
  6. Organization: Singapore Telecom Internet Service
  7. Message-ID: <4iikju$nk8@lantana.singnet.com.sg>
  8. NNTP-Posting-Host: ts900-4120.singnet.com.sg
  9. X-Newsreader: Forte Free Agent 1.0.82
  10.  
  11. How do I get the user to input filename for fopen()  ?
  12.  
  13.  I tried a gets(filename) before a fopen(filename,"r"). It worked for
  14. files in the current dir (when the user only has to enter the
  15. filename) , but  it does not work for files in other dirs (when the
  16. user has to enter something like "c:\\windows\\letter.txt").
  17.  
  18. When I tried to type the filename directly into fopen(), it worked
  19. fine for any file any where.
  20. So I guess the problem lies in the ' \ '  because C treats it as an
  21. escape sequence. How do I get around this?
  22.  
  23. Thank you.
  24.  
  25.